<!-- 返回首页 -->
<template>
    <footer class="footer" v-show="showFooter">
        <router-link tag="button" :to="'/'" class="fs30rem btn pl30rem pr30rem cxo-red white">
            <p>
                <span>返回首页</span>
            </p>
        </router-link>
    </footer>
</template>
<style>
    .footer {
        position: fixed;
        width: 100%;
        text-align: center;
        bottom: 15px;
    }
</style>
<script>
    export default {
        name: 'ShareFooter',
        data()
        {
            return {
                showFooter: false
            }
        },
        mounted()
        {
            window.addEventListener('scroll', this.overScroll)
        },
        methods: {
            // 页面置顶
            overScroll () {
                let top = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop;
                this.showFooter = top > 300;
            }
        }
    }
</script>